﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/AdminSite.Master"
    Inherits="System.Web.Mvc.ViewPage<Veteran_cms.Models.comment>" %>

<%@ Import Namespace="Veteran_cms.Models" %>
<asp:Content ID="Content1" ContentPlaceHolderID="MainContentPlaceHolder" runat="server">
    <!-- Validation form -->
    <%using (Html.BeginForm("Create", "ManageComment", FormMethod.Post, new { enctype = "multipart/form-data", @class = "form", id = "validate" }))
      { %>
    <!-- Multiple files uploader -->
    <%var ctx = new Veterandb(); %>
    <fieldset>
        <div>
            <div class="widget">
                <div style="float: right">
                    <a href="<%=Url.Action("IndexComments","ManageComment") %>" title="" class="backTo"
                        style="margin: 5px;">
                        <img src="../../images/adminSite/icons/prev.png" alt="" class="icon" /><span>Trở về</span></a></div>
                <div class="title">
                    <img src="../../Images/adminSite/icons/dark/pencil.png" alt="" class="titleIcon" /><h6>
                        Thông tin Nhận xét</h6>
                </div>
                <%if (ViewData["Msg"] != null)
                  {%>
                <div class="nNote nSuccess hideit">
                    <p>
                        <strong>
                            <%=ViewData["Msg"]%></strong></p>
                </div>
                <%} %>
                <div class="formRow">
                    <label>
                        Tiêu đề:<span class="req">*</span></label>
                    <div class="formRight">
                        <%:Html.TextBoxFor(model => model.title, new { @class = "validate[required,maxSize[255]]", id = "req" })%></div>
                    <div class="clear">
                    </div>
                </div>
                <div class="formRow">
                    <label>
                        Nội dung:<span class="req">*</span></label>
                    <div class="formRight">
                        <%:Html.TextAreaFor(model => model.content, new { @class = "validate[required]", id = "editor", name = "editor" })%></div>
                    <div class="clear">
                    </div>
                </div>
                <div class="formRow">
                    <label>
                        Trạng thái:<span class="req">*</span></label>
                    <div class="formRight">
                        <%:Html.DropDownListFor(model => model.is_active, ViewData["CommentStatus"] as SelectList)%>
                    </div>
                    <div class="clear">
                    </div>
                </div>
                <div class="formRow">
                    <label>
                        Loại nhận xét:<span class="req">*</span></label>
                    <div class="formRight">
                        <%:Html.DropDownListFor(model => model.comment_type, ViewData["CommentTypes"] as SelectList,new { disabled = "disabled" })%>
                    </div>
                    <div class="clear">
                    </div>
                </div>
                <div class="formRow">
                    <label>
                        Bài nhận xét:<span class="req">*</span></label>
                    <div class="formRight">
                        <%
                  var title = string.Empty;
                  switch (Model.comment_type)
                  {
                      case "News":
                          var news = ctx.news_article.FirstOrDefault(x => x.article_id == Model.object_id);
                          if (news != null) title = news.title;
                          break;
                      case "Blog":
                          var blog = ctx.blogs.FirstOrDefault(x => x.blog_id == Model.object_id);
                          if (blog != null) title = blog.title;
                          break;
                      default:
                          var comment = ctx.comments.FirstOrDefault(x => x.comment_id == Model.object_id);
                          if (comment != null) title = comment.title;
                          break;
                  }
               
                 
                        %>
                        <%:Html.Label(title)%>
                        <%:Html.HiddenFor(model => model.object_id)%>
                        <%:Html.HiddenFor(model => model.comment_type)%>
                    </div>
                    <div class="clear">
                    </div>
                </div>
                <div class="clear">
                </div>
            </div>
            <div class="formRow">
                <label>
                    Họ & tên:<span class="req">*</span></label>
                <div class="formRight">
                    <%:Html.TextBoxFor(model => model.full_name,  new {@class = "validate[required]",id="req"})%></div>
                <div class="clear">
                </div>
            </div>
            <div class="formRow">
                <label>
                    Email:<span class="req">*</span></label>
                <div class="formRight">
                    <%:Html.TextBoxFor(model => model.email,  new {@class = "validate[required,custom[email]]",id="req"})%></div>
                <div class="clear">
                </div>
            </div>
        </div>
        <div class="widget">
            <%using (Html.BeginForm("Delete", "ManageComment", new { id = Model.comment_id }, FormMethod.Post, new { enctype = "multipart/form-data", @class = "form" }))
              { %>
            <div class="formSubmit">
                <input type="submit" value="Xóa" class="redB" /></div>
            <%} %>
            <div class="formSubmit">
                <input type="submit" value="Lưu" class="blueB" /></div>
            <%} %>
            <div class="clear">
            </div>
            <div>
                <%:Html.HiddenFor(model => model.comment_id)%></div>
        </div>
    </fieldset>
</asp:Content>
